//
//  WMSDKManager.h
//  WonderMobSDK
//
//  Created by zero on 2021/11/4.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol WMSDKAdManagerDelegate <NSObject>

@optional

#pragma mark ---- 激励视频广告回调 ----
/// 视频广告数据加载成功回调
- (void)wm_rewardVideoAdDidLoad;

/// 视频广告视频展示成功
- (void)wm_rewardVideoAdDidRenderSuccess;

/// 视频广告各种错误信息回调
/// @param error 具体错误信息
- (void)wm_rewardVideoAdDidFailWithError:(NSError *)error;

/// 视频广告播放达到激励条件回调
- (void)wm_rewardVideoAdDidRewardEffective;
 
/// 视频广告视频播放完成
- (void)wm_rewardVideoAdDidPlayFinish;

/// 视频广告视频被点击
- (void)wm_rewardVideoAdDidClicked;

#pragma mark ---- 全屏广告回调 ----
/// 全屏广告数据加载成功回调
- (void)wm_fullscreenVideoAdDidLoad;

/// 全屏广告各种错误信息回调
- (void)wm_fullscreenVideoAdDidFailWithError:(NSError * _Nullable)error;
 
/// 全屏广告被点击
- (void)wm_fullscreenVideoAdDidClick;

/// 视频广告视频展示成功
- (void)wm_fullscreenVideoAdDidRenderSuccess;

/// 视频广告视频播放完成
- (void)wm_fullscreenVideoAdDidPlayFinish;

/// 全屏广告被关闭
- (void)wm_fullscreenVideoAdDidClose;

#pragma mark ---- Banner广告回调 ----
/// Banner广告数据加载成功回调
- (void)wm_bannerAdDidLoadSuccess;

/// Banner广告各种错误信息回调
/// @param error 具体错误信息
- (void)wm_bannerAdDidFailWithError:(NSError *)error;

/// 需要在点击叉以后 在这个回调中移除视图，否则，会出现用户点击叉无效的情况
/// @param filterWords [BUDislikeWords] 关闭的原因
- (void)wm_bannerAdDislikeWithReason:(nullable NSArray<id> *)filterWords;

#pragma mark ---- 开屏广告回调 ----
/// 开屏数据加载成功回调
- (void)wm_splashAdDidLoadSuccess;

/// 开屏广告各种错误信息回调
/// @param error 具体错误信息
- (void)wm_splashAdDidFailWithError:(NSError *)error;

/// 开屏广告被点击
- (void)wm_splashAdDidClick;

/// 开屏广告被关闭
- (void)wm_splashAdDidClose;

#pragma mark ---- 信息流广告回调 ----
/// 广告数据加载成功回调
- (void)wm_feedAdDidLoadSuccess;

/// 视频广告各种错误信息回调
/// @param error 具体错误信息
- (void)wm_feedAdDidFailWithError:(NSError *)error;

/// 需要在点击叉以后 在这个回调中移除视图，否则，会出现用户点击叉无效的情况
/// @param filterWords [BUDislikeWords] 关闭的原因
- (void)wm_feedAdDislikeWithReason:(NSArray<NSObject *> *)filterWords;

@end

typedef NS_OPTIONS(NSUInteger, WMSDKAdType) {
    WMAdTypeNotSetup = 0,
    WMAdTypeSplashAd = 1 << 0,
    WMAdTypeRewardedAd = 1 << 1,
    WMAdTypeFullscreenVideoAd = 1 << 2,
    WMAdTypeBannerAd = 1 << 3,
    WMAdTypeFeedAd = 1 << 4,
    WMAdTypeAll = WMAdTypeSplashAd | WMAdTypeRewardedAd | WMAdTypeFullscreenVideoAd | WMAdTypeBannerAd | WMAdTypeFeedAd,
};


typedef void(^AdMobSDKProtocolConfirmBlock)(void);

typedef void(^AdMobSDKAuthBlock)(BOOL isAuth);

typedef void(^NotificationMessageBlock)(NSDictionary *notificationMsg);

@interface WMSDKManager : NSObject

@property (nonatomic, weak) id<WMSDKAdManagerDelegate> delegate;

/// 同意隐私条款回调
@property (nonatomic, copy) AdMobSDKProtocolConfirmBlock adProtocolConfirmBlock;

/// 是否实名认证回调
@property (nonatomic, copy) AdMobSDKAuthBlock adAuthBlock;

/// 根视图
@property (nonatomic, strong) UIViewController *rootViewController;

@property (nonatomic, assign) WMSDKAdType adType;

@property (nonatomic, assign) CGRect bannerFrame;

@property (nonatomic, assign) CGSize feedSize;

/// launchOptions
@property (nonatomic, copy) NSDictionary *wmLaunchOptions;

/// 是否自动注册通知
@property (nonatomic, assign) BOOL autoStartNotification;

/// 是否实名认证回调
@property (nonatomic, copy) NotificationMessageBlock msgBlock;


+ (instancetype)adManager;


/// 开始初始化SDK
- (void)startInit;

/// 初始化BMS
/// @param bmsName bms唯一标识
/// @param bmsVersion bms版本号
- (void)setupWithBMSName:(NSString *)bmsName AndBMSVersion:(NSString *)bmsVersion;


/// 初始化所有广告（手动）
/// 调用该接口时，必须要要先将  rootViewController， bannerFrame， feedSize赋值
/// 该接口需要在 “同意隐私条款回调adProtocolConfirmBlock” 回调后再调用
- (void)setupAllAd;


#pragma mark ---- 开屏广告 ----
/// 初始化开屏
+ (void)setupSplashAd;


/// 显示开屏广告
- (void)showSplashAd;


#pragma mark ---- 激励视频广告 ----
/// 初始化激励视频
+ (void)setupRewardedAd;


/// 显示激励视频
/// @param vc 要显示的页面
/// @param posId 广告ID，如果没有，传入 @""
- (void)showRewardedVideoAd:(UIViewController *)vc posId:(NSString *)posId;


#pragma mark ---- 全屏视频广告 ----
/// 初始化全屏视频
+ (void)setupFullscreenVideoAd;


/// 显示全屏视频
/// @param vc 要显示的页面
/// @param posId 广告ID，如果没有，传入 @""
- (void)showFullscreenVideoAd:(UIViewController *)vc posId:(NSString *)posId;


#pragma mark ---- Banner广告 ----
/// 初始化Banner
/// @param frame 要显示的位置
+ (void)setupBannerAdWithFrame:(CGRect)frame;


/// 展示Banner
/// @param posId 广告ID，如果没有，传入 @""
- (void)showBannerAdWithId:(NSString *)posId;


/// 隐藏Banner
/// @param posId 广告ID，如果没有，传入 @""
- (void)hideBannerAdWithId:(NSString *)posId;


#pragma mark ---- 信息流广告 ----
/// 初始化信息流
/// @param size 信息流广告大小
+ (void)setupFeedAdWithSize:(CGSize)size;

/// 显示信息流
/// @param frame 要显示的位置
/// @param posId 广告ID，如果没有，传入 @""
- (void)showFeedAdWithFrame:(CGRect)frame posId:(NSString *)posId;


/// 隐藏信息流广告
/// @param posId 广告ID，如果没有，传入 @""
- (void)hideFeedAdWithId:(NSString *)posId;


#pragma mark ---- 远程推送 ----
/// 开启初始化应用通知，需要在同意隐私条款后再调用
- (void)startSetupNotification;


/// SDK内部远程消息处理
/// @param application application
/// @param userInfo userInfo
/// @param completionHandler completionHandler
- (void)wmb_application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler;



//#ifdef DEBUG
//@property (nonatomic, copy) void(^logBlock)(NSString *log);
//@property (nonatomic, copy) void(^rewardLogBlock)(NSString *log);
//@property (nonatomic, copy) void(^fullBlock)(NSString *log);
//@property (nonatomic, copy) void(^logBannerBlock)(NSString *log);
//@property (nonatomic, copy) void(^logFeedBlock)(NSString *log);
//#endif



@end

NS_ASSUME_NONNULL_END
